home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
-
- Global ngFileHandle% ' Handle to AV file
-
- ' Button Indexes
- Global Const CTRL_OPEN = 0
- Global Const CTRL_PLAY = 1
- Global Const CTRL_PAUSE = 2
- Global Const CTRL_STOP = 3
- Global Const CTRL_CLOSE = 4
-
-
- Global Const VOL_MAX = 100
- Global Const VOL_NORM = 30
- Global Const VOL_MULT = 10
-
- Global Const SPEED_MAX = 200
- Global Const SPEED_NORM = 100
- Global Const SPEED_MULT = 10
-
- Global Const SET_SIZE = 0
- Global Const SET_CLIP = 1
-
- Global Const INFO_FRAME = 0
- Global Const INFO_STATE = 1
- Global Const INFO_LENGTH = 2
- Global Const INFO_RATE = 3
- Global Const INFO_TIME = 4
- Global Const INFO_COLOR_RED = 5
- Global Const INFO_COLOR_GREEN = 6
- Global Const INFO_COLOR_BLUE = 7
-
-
- Global Const STATE_CLOSED = "Closed"
- Global Const STATE_PAUSED = "Paused"
- Global Const STATE_PLAYING = "Playing"
- Global Const STATE_END = "End"
- Global Const STATE_STOPPED = "Stopped"
-
- Global Const STATE_VAL_CLOSED = 0
- Global Const STATE_VAL_PLAYING = 1
- Global Const STATE_VAL_PAUSED = 3
- Global Const STATE_VAL_END = 4
- Global Const STATE_VAL_STOPPED = 5
-
- Function nFuncOpenMedia% (ByVal hwnd%, ByVal szFileName$, ByVal nWidth%, ByVal nHeight%, ByVal lBegFrame&, ByVal lEndFrame&)
-
- Dim nTmpWidth%, nTmpHeight%
- Dim nXPos%, nYPos%
- Dim nHandle%
-
- ' This is done to control the number of open files in this sample
- ' application to 1. It is not done because of a limitation of
- ' the mdCtrl Software.
- If ngFileHandle Then ngFileHandle = mdClose(ngFileHandle)
-
- If frmMDSample.chkAutoSize Then ' Setup for autosize
-
- nTmpWidth = MD_VIDSIZE_W_AUTOMATIC
- nTmpHeight = MD_VIDSIZE_H_AUTOMATIC
-
- Else ' Validate user values FRAME_DEFAULT_BEG
-
- nTmpWidth = nWidth
- nTmpHeight = nHeight
-
- If nWidth = 0 Then
- nTmpWidth = MD_VIDSIZE_W_AUTOMATIC
- ElseIf nWidth < 7 Then
- nTmpHeight = MD_VIDSIZE_H_AUTOMATIC
- End If
-
- If nHeight = MD_VIDSIZE_H_AUTOMATIC And nWidth > 6 Then
- nTmpWidth = MD_VIDSIZE_W_AUTOMATIC
- End If
-
- End If
-
- sbrUpdateStatus "Opening the file: " & szFileName
- ' Open the file but don't show it immediately
- ' so that I can position it. This is done since
- ' I don't know the size yet.
- nHandle = mdOpen(hwnd, szFileName, 0, 0, nTmpWidth, nTmpHeight, lBegFrame, lEndFrame, MD_CONTROL_INT_NONMODAL, MD_LOAD_AV_HIDDEN)
-
- If nHandle Then
- sbrUpdateStatus "Open Successful, Sizing and Positioning"
-
- ' Let the file tell me the width and height
- mdGetWinSize nHandle, nTmpWidth, nTmpHeight
-
- ' Calculate the X,Y position
- nXPos = Int(((frmMDSample.Width / 15) - nTmpWidth) / 2)
- nYPos = Int((240 - nTmpHeight) / 2)
-
- mdSetWinPos nHandle, nXPos, nYPos ' Put the window
-
- If frmMDSample.chkVisible Then ' Show it?
- If frmMDSample.chkControlBar Then ' Show all
- mdShow nHandle
- Else
- mdShowVideo nHandle ' Show just the video window
- End If
- End If
-
- sbrUpdateStatus "Open Successful"
-
- Else
-
- sbrUpdateStatus "Open Unsuccessful"
-
- End If
-
- nFuncOpenMedia = nHandle ' Return the handle
-
- End Function
-
- Sub sbrOpenFile (szFileName$)
-
- sbrUpdateStatus "File Search"
- '....Following code created by CMDialog Thing
- frmMDSample.dlgFileOpen.CancelError = True
- frmMDSample.dlgFileOpen.DefaultExt = ""
- frmMDSample.dlgFileOpen.DialogTitle = "Select Audio/Video File"
- frmMDSample.dlgFileOpen.Filename = ""
- frmMDSample.dlgFileOpen.FilterIndex = 0
- frmMDSample.dlgFileOpen.Filter = "AVI Files (*.avi)|*.avi|AVS Files (*.avs)|*.avs|MPEG Files (*.mpg)|*.mpg|Wave Files (*.wav)|*.wav"
- frmMDSample.dlgFileOpen.HelpCommand = 0
- frmMDSample.dlgFileOpen.HelpContext = 0
- frmMDSample.dlgFileOpen.HelpFile = ""
- frmMDSample.dlgFileOpen.HelpKey = ""
- frmMDSample.dlgFileOpen.InitDir = ""
- frmMDSample.dlgFileOpen.MaxFileSize = 256
- frmMDSample.dlgFileOpen.Flags = OFN_OVERWRITEPROMPT Or OFN_PATHMUSTEXIST
-
- On Error GoTo DialogError
-
- frmMDSample.dlgFileOpen.Action = 1
-
- szFileName = frmMDSample.dlgFileOpen.Filename
-
- sbrUpdateStatus "File Found...Click The Open Button To Open The File"
-
- Exit Sub
-
- DialogError:
-
- sbrUpdateStatus "File Search Cancelled"
-
- Exit Sub
-
-
- End Sub
-
- Sub sbrUpdateStatus (ByVal szStatus$)
-
- frmMDSample.pnlStatus = szStatus
-
- End Sub
-
-